#include <bits/stdc++.h>
#define st first
#define nd second
#define MP make_pair
using namespace std;
const int N=2e5+5;
int n,a[N],cnt[N];
int ans1,ans2;
multiset<pair<int,int> > d1,d2;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        cnt[a[i]]=i;
        d1.insert(MP(a[i],i));
        d2.insert(MP(a[i],i));
    }
    while(1){
        pair<int,int> x=*d1.begin();
        auto ly=d2.upper_bound(MP(x.st,cnt[x.st]));
        if(ly==d2.end())break;
        pair<int,int> y=*ly;
        d1.erase(x);
        d2.erase(x);
        d2.erase(y);
    }
    cout<<d1.size();
    return 0;
}
